<?php $this->load->view('layout/header'); ?>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <h3 class="page-title">商品订单管理<small> 商品订单管理</small></h3>
            <?php echo breadcrumb(array('商品订单管理', "tourismorder/grid" => '订单管理')); ?>
        </div>
    </div>
    <?php echo execute_alert_message() ?>
    <div class="row-fluid">
        <div class="span12">
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-search"></i>搜索</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body form">
                    <form class="form-horizontal form-search" action="<?php echo base_url('tourismorder/grid') ?>" method="get">
                        <div class="row-fluid">
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">编　　号</label>
                                    <div class="controls">
                                        <input type="text" name="order_id" value="<?php echo $this->input->get('order_id'); ?>" class="m-wrap span12" placeholder="订单ID">
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">订单编号</label>
                                    <div class="controls">
                                        <input type="text" name="order_sn" value="<?php echo $this->input->get('order_sn'); ?>" class="m-wrap span12" placeholder="订单编号">
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">订单状态</label>
                                    <div class="controls">
                                        <select name="order_status" class="m-wrap span12">
                                            <option value="0">请选择</option>
                                            <?php foreach ($orderStatus as $key => $value): ?>
                                                <option value="<?php echo $key ?>" <?php if ($key == $this->input->get('order_status')): ?>selected="selected"<?php endif; ?>><?php echo $value; ?></option>
                                            <?php endforeach; ?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">供 应 商</label>
                                    <div class="controls">
                                        <input type="text" name="seller_alias_name" value="<?php echo $this->input->get('seller_alias_name'); ?>" class="m-wrap span12" placeholder="请输入供应商用户名或别名">
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">购 买 者</label>
                                    <div class="controls">
                                        <input type="text" name="payer_uid" value="<?php echo $this->input->get('payer_uid'); ?>" class="m-wrap span12" placeholder="请输入购买者用户或者UID编号">
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">有效起始</label>
                                    <div class="controls form-search-time">
                                        <div class="input-append date date-picker">
                                            <input type="text" name="start_date" size="16" value="<?php echo $this->input->get('start_date') ? $this->input->get('start_date') : date('Y-01-01') ?>" class="m-wrap m-ctrl-medium date-picker date">
                                            <span class="add-on"><i class="icon-calendar"></i></span>
                                        </div>
                                        <div class="input-append date date-picker">
                                            <input type="text" name="end_date" size="16" value="<?php echo $this->input->get('end_date') ? $this->input->get('end_date') : date('Y-12-31') ?>" class="m-wrap m-ctrl-medium date-picker date">
                                            <span class="add-on"><i class="icon-calendar"></i></span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">手机号码</label>
                                    <div class="controls">
                                        <input type="text" name="receive_phone" value="<?php echo trim($this->input->get('receive_phone')); ?>" class="m-wrap span12" placeholder="收货人手机号码"/>
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">商品名称</label>
                                    <div class="controls">
                                        <input type="text" name="goods_name" value="<?php echo trim($this->input->get('goods_name')); ?>" class="m-wrap span12" placeholder="购买的商品名称"/>
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <label class="control-label">订单备注</label>
                                    <div class="controls">
                                        <input type="text" name="order_note" value="<?php echo trim($this->input->get('order_note')); ?>" class="m-wrap span12" placeholder="订单备注，着想员工自己插入"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-actions">
                            <button class="btn green" type="submit">搜索</button>
                            <button class="btn reset_button_search" type="button">重置条件</button>
                            <button class="btn blue" type="submit" name="excel" value="excel" >导出产品订单excel</button>
                            <a class="btn blue" href="<?php echo base_url('tourismorder/grid?order_status=3');?>">未发货订单</a>
                        </div>
                    </form>
                </div>
            </div>
            <div class="portlet box green">
                <div class="portlet-title">
                    <div class="caption"><i class="icon-reorder"></i>列表</div>
                    <div class="tools">
                        <a class="collapse" href="javascript:;"></a>
                        <a class="remove" href="javascript:;"></a>
                    </div>
                </div>
                <div class="portlet-body flip-scroll">
                    <div class="dataTables_wrapper form-inline">
                        <div class="row-fluid scebery-order-pagination">
                            <span class="dataTables_info">
                                <span>当前第</span><span style="color: red"><?php echo $pg_now?></span>页 
                                <span>共</span><span style="color: red"><?php echo $all_rows?></span>条数据
                                <span>每页显示20条 </span>
                                <?php echo $pg_list ?>
                            </span>
                            <span class="scebery-order-find">
                               <input type="text" name="pg" value="<?php echo isset($pg_now) ? $pg_now :'';?>" class="m-wrap small" placeholder="请输入页数" />
                               <button type="button" class="btn green">确定</button>
                            </span>
                        </div>
                        <?php if ($page_list->num_rows() > 0) : ?>
                            <table class="table table-striped table-bordered table-hover" id="sample_1">
                                <thead class="flip-content">
                                    <tr>
                                        <th>编号</th>
                                        <th>订单编号</th>
                                        <th>供应商</th>
                                        <th>购买者</th>
                                        <th>收货人</th>
                                        <th>支付状态</th>
                                        <th>订单状态</th>
                                        <th>销售总价</th>
                                        <th>实际应付</th>
                                        <th>实际支付(不含运费)</th>
                                        <th>实际应付U币</th>
                                        <th>运费价格</th>
                                        <th>下单时间</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php foreach ($page_list->result() as $item) : ?>
                                    <tr>
                                        <td><?php echo $item->order_id ?></td>
                                        <td><?php echo $item->order_sn ?></td>
                                        <td>
                                            <p><?php echo $item->provider_name ?></p>
                                            <p><?php echo $item->alias_name ?></p>
                                            <p><?php echo empty($item->cellphone) ? $item->mobile_phone : $item->cellphone;?></p>
                                        </td>
                                        <td>
                                            <p><?php echo $item->user_name ?></p>
                                            <p><?php echo $item->payer_uid ?></p>
                                        </td>
                                        <td>
                                            <p><?php $detail = json_decode($item->detail); echo $detail->detailed;?></p>
                                            <p><?php echo $detail->receiver_name.'/'.$detail->tel;?></p>
                                        </td>
                                        <td><?php echo $orderState[$item->order_state]; ?></td>
                                        <td><?php echo $orderStatus[$item->order_status]; ?></td>
                                        <td><?php echo $item->order_price ?></td>
                                        <td><?php echo $item->actual_price ?></td>
                                        <td>
                                            <p><?php echo $item->order_pay_total ?></p>
                                            <?php if ($item->is_form == 2) :?>
                                                <p class="btn mini blue">手机订单</p>
                                            <?php endif;?>
                                        </td>
                                        <td><?php echo $item->pay_swim;?></td>
                                        <td><?php echo $item->transport_cost ?></td>
                                        <td><?php echo $item->created_at ?></td>
                                        <td width="50">
                                            <a class="btn mini green" href="<?php echo base_url('tourismorder/edit/' . $item->order_id) ?>">查看</a>
                                        </td>
                                    </tr>
                                <?php endforeach; ?>
                                <tr>
                                    <td colspan="7">总计</td>
                                    <td><?php echo $order_sum->order_price; ?></td>
                                    <td><?php echo $order_sum->actual_price; ?></td>
                                    <td><?php echo $order_sum->order_pay_total; ?></td>
                                    <td><?php echo $order_sum->pay_swim; ?></td>
                                    <td><?php echo $order_sum->transport_cost; ?></td>
                                    <td colspan="3"></td>
                                </tr>
                                </tbody>
                            </table>
                            <div class="row-fluid">
                                <div class="dataTables_info">
                                    <span>当前第</span><span style="color: red"><?php echo $pg_now ?></span>页
                                    <span>共</span><span style="color: red"><?php echo $all_rows ?></span>条数据
                                    <span>每页显示20条 </span>
                                    <?php echo $pg_list ?>
                                </div>
                            </div>
                        <?php else : ?>
                            <div class="alert"><p>未找到数据。<p></div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$('.scebery-order-find  button').click(function(){
	var pg = $(this).parents('.scebery-order-find').find('input[name="pg"]').val();
	if (pg.length==0) {
	    return false;
	}
	window.location.href="<?php echo base_url('tourismorder/grid')?>"+"/"+pg+"<?php echo isset($url) ? $url :'';?>";
})
</script>
<?php $this->load->view('layout/footer'); ?>